package mlz.a_threadapi;

public class Demo03 {
    public static void main(String[] args) {
        Runnable r1 = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    Thread t = Thread.currentThread();
                    System.out.println(t.getName() + ":" + i);
                }
            }
        };

        Runnable r2 = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    Thread t = Thread.currentThread();
                    System.out.println(t.getName() + ":" + i);
                }
            }
        };



        Thread t1 = new Thread(r1);
        Thread t2 = new Thread(r2);


        //设置线程优先级
        t1.setPriority(10);
        t1.setPriority(1);


        t1.start();
        t2.start();
    }
}
